package com.wedo.mall.fragment;

import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.e.library.fragment.EFragment;
import com.wedo.mall.R;
import com.wedo.mall.activity.MainActivity;
import com.wedo.mall.adapter.CategoryAdapter;
import com.wedo.mall.entity.Category;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * Created by lxy on 2017/6/8.
 */

public class SellerFragment extends EFragment<MainActivity> {

    @BindView(R.id.rv_category) RecyclerView rv_category;


    public static SellerFragment with(){
        return new SellerFragment();
    }

    @Override
    protected int layout() {
        return R.layout.fragment_seller;
    }

    @Override
    protected void onFragmentCreated(View contentView, Bundle bundle) {
        rv_category.setHasFixedSize(true);
        rv_category.setNestedScrollingEnabled(false);
        rv_category.setLayoutManager(new GridLayoutManager(getContext(),4));
        rv_category.setAdapter(new CategoryAdapter(getContext(),categories()));
    }

    private List<Category> categories(){
        List<Category> categories = new ArrayList<>(8);
        categories.add(Category.with(0,"电器"));
        categories.add(Category.with(0,"酒店"));
        categories.add(Category.with(0,"花店"));
        categories.add(Category.with(0,"修车"));
        categories.add(Category.with(0,"美食"));
        categories.add(Category.with(0,"水果"));
        categories.add(Category.with(0,"生鲜"));
        categories.add(Category.with(0,"更多分类"));

        return categories;

    }
}
